//
//  MyDatailViewController.swift
//  KaKaWallet
//
//  Created by apple on 16/4/8.
//  Copyright © 2016年 ibendi. All rights reserved.
//

import UIKit

class MyDatailViewController: SuperViewController,UITableViewDelegate,UITableViewDataSource {

    var dataTable:UITableView!
    var itemString=["昵称","账号","性别","地区","我的爱车"]
     //当前屏幕对象
    var screenObject=UIScreen.main.bounds;
    
    //页面初始化
    override func viewDidLoad() {
        super.viewDidLoad()
        
        self.title="我的资料"
        self.view.backgroundColor=UIColor.red
        
        dataTable = UITableView(frame: CGRect(x: 0,y: self.view_startY, width: self.view.frame.size.width, height: self.view.frame.size.height),style:UITableViewStyle.grouped)
        dataTable.delegate = self
        dataTable.dataSource = self
        self.view.addSubview(dataTable)
        
        ZYSystem.start.kkGetPickerPhoto { (newImage) in
            print(newImage)
        }
        
        
    }
      //1.1默认返回一组
    func numberOfSections(in tableView: UITableView) -> Int
    {
        return 2;
    }
    
    // 1.2 返回行数
    func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int
    {
        if(section == 0){
            return 1;
        }else{
            return 5;
        }
    }
    
    //1.3 返回行高
    func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat
    {
        if(indexPath.section == 0){
            return 80;
        }else{
            return 55;
        }
    }
    
    //1.4每组的头部高度
    func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat
    {
        return 10;
    }
    //1.5每组的底部高度
    func tableView(_ tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat
    {
        return 1;
    }
    //1.6 返回数据源
    func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell
    {
        let identifier="identtifier";
        var cell=tableView.dequeueReusableCell(withIdentifier: identifier);
        if(cell == nil){
            cell=UITableViewCell(style: UITableViewCellStyle.value1, reuseIdentifier: identifier);
        }
        
        if(indexPath.section == 0){
            cell?.textLabel?.text="头像";
        }else{
            cell?.textLabel?.text=itemString[indexPath.row];
        }
        cell?.accessoryType = UITableViewCellAccessoryType.disclosureIndicator;
        return cell!;
    }
    //1.7 表格点击事件
    func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath)
    {
        tableView.deselectRow(at: indexPath, animated: true);
        if(indexPath.row == 0){
        
        }
    }
    

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }
    

    /*
    // MARK: - Navigation

    // In a storyboard-based application, you will often want to do a little preparation before navigation
    override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
        // Get the new view controller using segue.destinationViewController.
        // Pass the selected object to the new view controller.
    }
    */

}
